﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace VisionCloud.Core.Migrations
{
    public partial class AddReportPointIndex : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "UpdateUserGuid",
                table: "SysUser",
                newName: "LastUpdatedBy");

            migrationBuilder.RenameColumn(
                name: "UpdateDateTime",
                table: "SysUser",
                newName: "LastUpdatedDate");

            migrationBuilder.RenameColumn(
                name: "CreateUserGuid",
                table: "SysUser",
                newName: "CreatedBy");

            migrationBuilder.RenameColumn(
                name: "CreateDateTime",
                table: "SysUser",
                newName: "CreatedDate");

            migrationBuilder.AddColumn<bool>(
                name: "IsDelete",
                table: "SysDevice",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AlterColumn<int>(
                name: "TaskType",
                table: "MsReport",
                type: "int4",
                nullable: false,
                oldClrType: typeof(int));

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreateReportDateTime",
                table: "MsReport",
                type: "timestamp",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp(0)");

            migrationBuilder.AddColumn<int>(
                name: "PointIndex",
                table: "MsReport",
                type: "int4",
                nullable: false,
                defaultValue: 0);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "IsDelete",
                table: "SysDevice");

            migrationBuilder.DropColumn(
                name: "PointIndex",
                table: "MsReport");

            migrationBuilder.RenameColumn(
                name: "LastUpdatedDate",
                table: "SysUser",
                newName: "UpdateDateTime");

            migrationBuilder.RenameColumn(
                name: "LastUpdatedBy",
                table: "SysUser",
                newName: "UpdateUserGuid");

            migrationBuilder.RenameColumn(
                name: "CreatedDate",
                table: "SysUser",
                newName: "CreateDateTime");

            migrationBuilder.RenameColumn(
                name: "CreatedBy",
                table: "SysUser",
                newName: "CreateUserGuid");

            migrationBuilder.AlterColumn<int>(
                name: "TaskType",
                table: "MsReport",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int4");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreateReportDateTime",
                table: "MsReport",
                type: "timestamp(0)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "timestamp");
        }
    }
}
